﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;

namespace linkouqs.Gamekit {

    [CustomEditor(typeof(CharacterSlot))]
    public class CharacterSlotEditor : Editor {


        public override void OnInspectorGUI() {
            base.OnInspectorGUI();

            CharacterSlot characterSlots = target as CharacterSlot;

            Transform transform = characterSlots.transform;
            System.Type type = typeof(Transform);
            bool enable = GUI.enabled;
            GUI.enabled = false;
            for (int i = 0; i < transform.childCount; i++) {
                Transform child = transform.GetChild(i);
                if (child.name.ToLower().EndsWith("slot", System.StringComparison.Ordinal)) {
                    EditorGUILayout.ObjectField("[" + i.ToString() + "]", child, type, true);

                }

            }
            GUI.enabled = enable;

        }
    }
}

